$this->verifyUpload();
// Check permission to upload this file
- $permErrors = $this->mUpload->verifyPermissions( $wgUser );
+ $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser );
if ( $permErrors !== true ) {
// TODO: stash the upload and allow choosing a new name
$this->dieUsageMsg( array( 'badaccess-groups' ) );
}
// Verify permissions for this title
- $permErrors = $this->mUpload->verifyPermissions( $wgUser );
+ $permErrors = $this->mUpload->verifyTitlePermissions( $wgUser );
if( $permErrors !== true ) {
$code = array_shift( $permErrors[0] );
$this->showRecoverableUploadError( wfMsgExt( $code,
const EMPTY_FILE = 3;
const MIN_LENGTH_PARTNAME = 4;
const ILLEGAL_FILENAME = 5;
- const OVERWRITE_EXISTING_FILE = 7; # Not used anymore; handled by verifyPermissions()
+ const OVERWRITE_EXISTING_FILE = 7; # Not used anymore; handled by verifyTitlePermissions()
const FILETYPE_MISSING = 8;
const FILETYPE_BADTYPE = 9;
const VERIFICATION_ERROR = 10;
}
}
+ /**
+ * Alias for verifyTitlePermissions. The function was originally 'verifyPermissions'
+ * but that suggests it's checking the user, when it's really checking the title + user combination.
+ * @param $user User object to verify the permissions against
+ * @return mixed An array as returned by getUserPermissionsErrors or true
+ * in case the user has proper permissions.
+ */
+ public function verifyPermissions( $user ) {
+ return $this->verifyTitlePermissions( $user );
+ }
+
/**
* Check whether the user can edit, upload and create the image. This
* checks only against the current title; if it returns errors, it may
* @return mixed An array as returned by getUserPermissionsErrors or true
* in case the user has proper permissions.
*/
- public function verifyPermissions( $user ) {
+ public function verifyTitlePermissions( $user ) {
/**
* If the image is protected, non-sysop users won't be able
* to modify it by uploading a new revision.
* Wrapper around the parent function in order to defer checking protection
* until we are sure that the file can actually be uploaded
*/
- public function verifyPermissions( $user ) {
+ public function verifyTitlePermissions( $user ) {
if ( $this->mAsync ) {
return true;
}
- return parent::verifyPermissions( $user );
+ return parent::verifyTitlePermissions( $user );
}
/**